package com.singzi.leetcode.jianzhiOffer2;

public class T0018 {
}
class Solution0018 {
    public boolean isPalindrome(String s) {

        StringBuilder sb = new StringBuilder();
        for(int i = 0;i < s.length();i++){
            char c = s.charAt(i);
            if(c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') sb.append(c);
        }
        int left = 0, right = sb.length() -1;
        while (left < right){
            if(sb.charAt(left) != sb.charAt(right) || (sb.charAt(left) - 'A') %32 != (sb.charAt(right) - 'A') %32) return false;
            else {
                left++;
                right--;
            }
        }
        return true;


    }
}